import moment from 'moment';
import qs from 'qs';

/**
 * json转url参数
 */
export function parseParam(param, obj) {
  if (!obj || !param) return param;
  var paramurl = param;
  var keys = Object.keys(obj);
  if (keys.length != 0) paramurl += '?' + qs.stringify(obj);
  return paramurl;
}

/**
 * 获取URL路由参数
 */
export function getUrlParams() {
  var dataStr = window.location.search.substr(1);
  return qs.parse(dataStr);
}
